package operatori;

/**
 * @author Sorica Alexandra
 * @date 18.04.2011
 * @version 1.0
 */

public class Plus extends Operator{
	public double calcul(double aux1, double aux2){
		return aux1 + aux2;
		}
	public static double Calcul(double aux1, double aux2){
		return aux1 + aux2;
		}
	public double calculeazaValoare(){
		if (ns==null || nd==null)
			System.exit(1);
		return calcul(ns.calculeazaValoare(), nd.calculeazaValoare());
		}
	public double calculDerivata(){
		if (ns==null || nd==null)
			System.exit(1);
		return calcul(ns.calculDerivata(), nd.calculDerivata());
		}
	public String derivare(){
		if (ns==null || nd==null)
			System.exit(1);
		return concatTermeni(ns.derivare(), nd.derivare());
		}
	public String concatTermeni(String aux1, String aux2){
		String aux;
		if (aux1.compareTo("0") == 0 || aux2.compareTo("0") == 0)
			aux = aux1;
		else if (aux1.compareTo("0") == 0) aux = aux2;
		else if (aux2.compareTo("0") == 0 ) aux = aux1;
		else
			aux = aux1 + "+" + aux2;
		return aux;
        }
	public static String concatTermens(String aux1, String aux2){
		String aux;
		if (aux1.compareTo("0") == 0 || aux2.compareTo("0") == 0)
			aux = aux1;
		else if (aux1.compareTo("0") == 0) aux = aux2;
		else if (aux2.compareTo("0") == 0 ) aux = aux1;
		else
			aux = aux1 + "+" + aux2;
		return aux;
		}
	@Override
	public String concat(String V1, String V2) {
		// TODO Auto-generated method stub
		return null;
	}
	}